package com.study.example.gameserver.module.ban.service;

import com.study.example.gameserver.module.ban.entity.BanServerData;
import com.study.example.gameserver.serverinfo.service.ServerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BanService {

    @Autowired
    ServerInfoService serverInfoService;

    public boolean isIpBanned(String ip) {
        BanServerData banData = serverInfoService.getObject(1, "Ban", BanServerData.class);
        return banData.getBanIps().containsKey(ip);
    }

    public boolean isAccountBanned(String account) {
        BanServerData banData = serverInfoService.getObject(1, "Ban", BanServerData.class);
        return banData.getBanAccounts().containsKey(account);
    }

}
